﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace The_LarX
{
    public class Plant : Component, ICloneable
    {
        public Renderer Renderer;

        public Plant(Renderer rend, GameScreen gs)
            : base(gs)
        {
            this.Renderer = rend;
            EngineSystem.Plants.Add(this);
        }
        public Plant()
            : base()
        {
            EngineSystem.Plants.Add(this);
        }

        public override void SerializeData()
        {
            base.SerializeData();

            Data.AddData("Renderer.Name", this.Renderer.Name);
        }
        public override void DeserializeData()
        {
            base.DeserializeData();

            string RendererName = Data.GetData<string>("Renderer.Name");
            Renderer = (Renderer)EngineSystem.GetRenderer(RendererName);
        }

        public override ICloneable Clone()
        {
            Plant plant = new Plant(this.Renderer, this.Parent);

            return plant;
        }
    }
}
